import { Sequelize } from 'sequelize-typescript'
import '~/config'
import { Account } from './models/Account'
import { AccountProxy } from './models/AccountProxy'
import { Token } from './models/Token'
import { User } from './models/User'

export default new Sequelize({
    dialect: 'mysql',
    host: process.env.DB_HOST,
    port: process.env.DB_PORT as any,
    username: process.env.DB_USER,
    password: process.env.DB_PASS,
    database: process.env.DB_NAME,
    dialectOptions: {
        charset: process.env.DB_CHARSET,
    },
    models: [Account, AccountProxy, Token, User],
    timezone: '+08:00',
    logging: false,
})

export { Account } from './models/Account'
export { AccountProxy } from './models/AccountProxy'
export { Token } from './models/Token'
export { User } from './models/User'
